package com.iwayin.core.dao.ask;

import java.util.List;

import com.iwayin.core.dataobject.AskDO;
import com.iwayin.core.vo.SearchVO;

public interface AskDAO {

	/**
	 * @author LiuWenLong
	 * @descriptions 创建ask
	 * @param ask
	 * @return
	 */
	Long addAsk(AskDO ask);

	/**
	 * 根据主键删除ask
	 * 
	 * @param ask
	 * @return
	 */
	Integer deleteAskById(AskDO ask);

	/**
	 * @author LiuWenLong
	 * @version 2012-3-6下午9:23:54
	 * @descriptions 查询问问题最多的用户ID(取前10位)
	 * @param Long
	 * @return
	 */
	List<Long> findHotAskUserId(AskDO ask);

	/**
	 * @author LiuWenLong
	 * @version 2012-3-6下午9:52:57
	 * @descriptions 查询热门问题(取前10位)
	 * @param Long
	 * @return
	 */
	List<AskDO> findHotAsk(AskDO ask);

	/**
	 * @author LiuWenLong
	 * @version 2012-3-6下午10:27:27
	 * @descriptions 根据ID查询ask
	 * @param userId
	 * @return
	 */
	AskDO getAskById(Long userId);

	/**
	 * @author LiuWenLong
	 * @version 2012-3-7下午8:22:40
	 * @descriptions 最新的问题(取前10位)
	 * @return
	 */
	List<AskDO> findLastestAsk(AskDO ask);

	/**
	 * @author ZhangLei
	 * @descriptions 查询自己的ask
	 * @param userId
	 * @return
	 */
	List<AskDO> findUserAsks(AskDO ask);

	/**
	 * @author LiuWenLong
	 * @version 2012-3-8下午9:24:04
	 * @descriptions 查询关注的问题
	 * @param ask
	 * @return
	 */
	List<AskDO> findFollowAak(AskDO ask);

	/**
	 * @author ZhangLei
	 * @descriptions 查询ask 通过id
	 * @param long
	 * @return
	 */
	public AskDO findAskByAskId(Long askId);

	/**
	 * @author ZhangLei
	 * @descriptions 查询当天ask最多的用户
	 * @param long
	 * @return
	 * 
	 */
	public List<AskDO> findAskMostToday(Long size);

	/**
	 * @author ZhangLei
	 * @descriptions 搜索ask
	 * @param long
	 * @return
	 * 
	 */
	public List<SearchVO> searchAsks(SearchVO query);

	/**
	 * ask评论数加1
	 * 
	 * @param askId
	 * @return
	 */
	public Integer askCommentCountPlusOne(Long askId);

	/**
	 * 
	 * @param askId
	 * @return
	 */
	public Integer askAnswerCountPlusOne(Long askId);

	/**
	 * 查询热门ask
	 **/
	public List<AskDO> findHotAskList(AskDO query);

	/**
	 * vote_count+1
	 * 
	 * @param askId
	 * @return
	 */
	public Integer voteCountPlusOne(Long askId);

	/**
	 * 查询当前ask的上一条，下一条ask
	 * 
	 * @param askId
	 * @return
	 */
	public List<AskDO> prevNextAskDetails(Long askId);

	/**
	 * @author LiuWenLong
	 * @version 下午10:16:50
	 * @descriptions likeCount + 1
	 */
	public void likeCountMinusOne(Long askId);

	/**
	 * @author LiuWenLong
	 * @version 下午10:16:50
	 * @descriptions likeCount - 1
	 */
	public void likeCountPlusOne(Long askId);
	/**
	 * 根据ask id查询ask列表
	 * @param askIds
	 * @return
	 */
	public List<AskDO> findAskListByIds(List<Long> askIds);
	/**
	 * 当天vote top5,发布时间为当天
	 * @return
	 * @author harry
	 */
	public List<AskDO> findTop5Ask(String orderBy);
}
